package water;

import java.util.Observable;
import java.util.Observer;
import java.util.Vector;

import water.WaterBoard.State;
import water.WaterBoard.WMove;

import klotski.KlotskiBoard.KMove;

import model.Board;
import model.BreadthFirstSearch;
import model.DepthFirstSearch;
import model.Search;

public class WaterMain {

	public static void main(String srgs[]) {
		final WaterBoard board = new WaterBoard();
		board.addObserver(new Observer() {
			public void update(Observable arg0, Object arg1) {
				board.display();
			}

		});

		Search search = new DepthFirstSearch(board);

		int result=search.explore();
		int depth=board.getDepth();
		int work=board.getWork();
		
		switch (result) {
	
		case Search.WIN:
			Vector<State> solution = new Vector<State>(board.history);
			while (board.undo()) {
			}

			System.out.println("************WIN******** " + depth + " " + work );

			for (State state : solution) {
				state.move.doMove();
			}
			break;

		case Search.FAIL:
			System.out.println("************FAILED********");

		}
	}
}
